﻿using System.Diagnostics;
using System.Reflection;
using System.Windows;

namespace HCDemo.HWindow
{
    public partial class AboutWindow
    {
        public AboutWindow()
        {
            InitializeComponent();

            DataContext = this;

            var versionInfo = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location);
            CopyRight = versionInfo.LegalCopyright;
            Version = $"V{versionInfo.FileVersion}";
            CompanyName = versionInfo.CompanyName;
            ProductName = versionInfo.ProductName;
        }

        public static readonly DependencyProperty CopyRightProperty = DependencyProperty.Register(
            "CopyRight", typeof(string), typeof(AboutWindow), new PropertyMetadata(default(string)));

        public string CopyRight
        {
            get => (string)GetValue(CopyRightProperty);
            set => SetValue(CopyRightProperty, value);
        }

        public static readonly DependencyProperty VersionProperty = DependencyProperty.Register(
            "Version", typeof(string), typeof(AboutWindow), new PropertyMetadata(default(string)));

        public string Version
        {
            get => (string)GetValue(VersionProperty);
            set => SetValue(VersionProperty, value);
        }

        public static readonly DependencyProperty ProductNameProperty = DependencyProperty.Register(
         "ProductName", typeof(string), typeof(AboutWindow), new PropertyMetadata(default(string)));

        public string ProductName
        {
            get => (string)GetValue(ProductNameProperty);
            set => SetValue(ProductNameProperty, value);
        }

        public static readonly DependencyProperty CompanyNameProperty = DependencyProperty.Register(
          "CompanyName", typeof(string), typeof(AboutWindow), new PropertyMetadata(default(string)));

        public string CompanyName
        {
            get => (string)GetValue(CompanyNameProperty);
            set => SetValue(CompanyNameProperty, value);
        }


    }
}
